﻿<UserControl x:Class="Ewav.Poisson"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:GadgetSelector="clr-namespace:Ewav.ContextMenu;assembly=Ewav.ContextMenu.Menu"
	xmlns:Common="clr-namespace:CommonLibrary;assembly=CommonLibrary"
	mc:Ignorable="d"
	d:DesignHeight="500" d:DesignWidth="900"
	xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
             xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">

    <UserControl.Resources>
        <Style x:Key="GlassButton" TargetType="Button">
            <Setter Property="Background" Value="#FF1F3B53"/>
            <Setter Property="Foreground" Value="#FF000000"/>
            <Setter Property="Padding" Value="3"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFA3AEB9" Offset="0"/>
                        <GradientStop Color="#FF8399A9" Offset="0.375"/>
                        <GradientStop Color="#FF718597" Offset="0.375"/>
                        <GradientStop Color="#FF617584" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid>
                            <vsm:VisualStateManager.VisualStateGroups>
                                <vsm:VisualStateGroup x:Name="CommonStates">
                                    <vsm:VisualState x:Name="Normal"/>
                                    <vsm:VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Pressed">

                                        <Storyboard>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                                                <SplineColorKeyFrame KeyTime="0" Value="#CC000000"/>
                                            </ColorAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="shine" Storyboard.TargetProperty="Opacity">
                                                <SplineDoubleKeyFrame KeyTime="0" Value="0.4"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="glow" 
												Storyboard.TargetProperty="(UIElement.Visibility)">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Collapsed</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Disabled">
                                        <!-- <Storyboard>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
												<SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard> -->
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="FocusStates">
                                    <vsm:VisualState x:Name="Focused">
                                        <!--<Storyboard>
											<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
												<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>-->
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Unfocused"/>
                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>
                            <Border BorderBrush="#FFFFFFFF" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
                                <Border x:Name="border" Background="#7F000000" BorderBrush="#FFA2A2B5" BorderThickness="1,1,1,1" CornerRadius="4,4,0,0">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="0.507*"/>
                                            <RowDefinition Height="0.493*"/>
                                        </Grid.RowDefinitions>
                                        <Border Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" Grid.RowSpan="2" CornerRadius="4,4,4,4">
                                            <Border.Background>
                                                <RadialGradientBrush>
                                                    <RadialGradientBrush.RelativeTransform>
                                                        <TransformGroup>
                                                            <ScaleTransform ScaleX="1.702" ScaleY="2.243"/>
                                                            <SkewTransform AngleX="0" AngleY="0"/>
                                                            <RotateTransform Angle="0"/>
                                                            <TranslateTransform X="-0.368" Y="-0.152"/>
                                                        </TransformGroup>
                                                    </RadialGradientBrush.RelativeTransform>
                                                    <GradientStop Color="#B28DBDFF" Offset="0"/>
                                                    <GradientStop Color="#008DBDFF" Offset="1"/>
                                                </RadialGradientBrush>
                                            </Border.Background>
                                        </Border>
                                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" Grid.RowSpan="2"/>
                                        <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" x:Name="shine" Width="Auto" CornerRadius="4,4,0,0">
                                            <Border.Background>
                                                <LinearGradientBrush EndPoint="0.494,0.889" StartPoint="0.494,0.028">
                                                    <GradientStop Color="#99FFFFFF" Offset="0"/>
                                                    <GradientStop Color="#33FFFFFF" Offset="1"/>
                                                </LinearGradientBrush>
                                            </Border.Background>
                                        </Border>
                                    </Grid>
                                </Border>
                            </Border>

                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Storyboard x:Name="expand">
            <PointAnimationUsingKeyFrames BeginTime="00:00:00" 
			      Storyboard.TargetName="popupMenu" 
			      Storyboard.TargetProperty="(UIElement.Clip).(PathGeometry.Figures)[0].(PathFigure.Segments)[0].(LineSegment.Point)"
            SpeedRatio="3">
                <SplinePointKeyFrame KeyTime="00:00:00" Value="0,0"/>
                <SplinePointKeyFrame KeyTime="00:00:01" Value="60,0"/>
            </PointAnimationUsingKeyFrames>

            <PointAnimationUsingKeyFrames BeginTime="00:00:00" 
			      Storyboard.TargetName="expandEffect" 
			      Storyboard.TargetProperty="(UIElement.Clip).(PathGeometry.Figures)[0].(PathFigure.Segments)[1].(LineSegment.Point)"
            SpeedRatio="3">
                <SplinePointKeyFrame KeyTime="00:00:00" Value="0,0"/>
                <SplinePointKeyFrame KeyTime="00:00:01" Value="60,50"/>
            </PointAnimationUsingKeyFrames>

            <PointAnimationUsingKeyFrames BeginTime="00:00:00" 
			      Storyboard.TargetName="expandEffect" 
			      Storyboard.TargetProperty="(UIElement.Clip).(PathGeometry.Figures)[0].(PathFigure.Segments)[2].(LineSegment.Point)"
            SpeedRatio="3">
                <SplinePointKeyFrame KeyTime="00:00:00" Value="0,0"/>
                <SplinePointKeyFrame KeyTime="00:00:01" Value="0,50"/>
            </PointAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" MouseRightButtonDown="LayoutRoot_MouseRightButtonDown"           
		  MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown">

        <Grid x:Name="GadgetWindow" Background="White" MinWidth="400" MinHeight="30" >
            <Rectangle x:Name="GWindow" Style="{StaticResource GWindow}" Grid.RowSpan="2" Stroke="{StaticResource WindowBrush}" StrokeThickness="4" d:LayoutOverrides="GridBox" />
            <StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="13,11,0,20" d:LayoutOverrides="VerticalAlignment, GridBox">
            	<TextBlock x:Name="GName" TextWrapping="Wrap" Text="StatCalc - Poisson" VerticalAlignment="Top" Margin="0,0,26,0" Height="Auto" HorizontalAlignment="Left" Foreground="#FF2B4360" FontSize="21.333"/>

            	<Rectangle x:Name="GHeader" VerticalAlignment="Top" Height="4" Margin="0,2,0,0" StrokeThickness="0" Fill="#FF00B050" />	
            </StackPanel>
            <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Margin="0,9,10,20" d:LayoutOverrides="Height" VerticalAlignment="Top">
            	<Button x:Name="ResizeButton" Content="" Template="{StaticResource resizebtn}" Cursor="Hand" Click="ResizeButton_Click" Width="24" Height="24" >
            		<Button.Effect>
            			<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
            		</Button.Effect>
            	</Button>
            	<Button x:Name="CloseButton" Content="" Template="{StaticResource CloseButton}" Cursor="Hand" Click="CloseGadget_Click" Width="24" Height="24" >
            		<Button.Effect>
            			<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
            		</Button.Effect>
            	</Button>
            </StackPanel>
            <Grid x:Name="GadgetContentGrid" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,47,0,0">
                <StackPanel x:Name="pnlMainContent" Margin="15,10,15,10" >
                    <TextBlock TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18.667"><Run Text="Poisson - Rare Event vs. Standard"/></TextBlock>
                    <Grid Height="250">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width=".5*" />
                            <ColumnDefinition Width=".5*" />
                        </Grid.ColumnDefinitions>
                        <Grid Grid.Column="0" HorizontalAlignment="Center">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="120"/>
                                <ColumnDefinition Width="120"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="50"/>
                                <RowDefinition Height="50"/>
                                <RowDefinition Height="50"/>
                            </Grid.RowDefinitions>
                            <TextBlock VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" TextWrapping="Wrap" Margin="0,0,-16,0"><Run Text="Observed # of events:"/></TextBlock>
                            <TextBox Grid.Row="0" Grid.Column="1" TextAlignment="Right" Height="30" Width="100" HorizontalAlignment="Right" FontFamily="Microsoft Sans Serif"  FontSize="20" x:Name="txtObserved"/>
                            <TextBlock VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" TextWrapping="Wrap" Margin="0,0,-16,0"><Run Text="Expected # of events:"/></TextBlock>
                            <TextBox Grid.Row="1" Grid.Column="1" TextAlignment="Right" Height="30" Width="100" HorizontalAlignment="Right" FontFamily="Microsoft Sans Serif"  FontSize="20" x:Name="txtExpected"/>
                        </Grid>
                        <Grid Grid.Column="1" HorizontalAlignment="Center" Margin="28,0,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="110" />
                                <ColumnDefinition Width="110" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="35"/>
                                <RowDefinition Height="26"/>
                                <RowDefinition Height="26"/>
                                <RowDefinition Height="26"/>
                                <RowDefinition Height="26"/>
                                <RowDefinition Height="26"	/>
                            </Grid.RowDefinitions>
                            <Rectangle Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"  Style="{StaticResource HeaderCell}"/>
                            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Text="Probability that the number&#xa;of events found is" Style="{StaticResource HeaderFont}" />
                            <Rectangle Grid.Column="0" Grid.Row="1" Style="{StaticResource DataCell}"/>
                            <TextBlock x:Name="lblLessThan" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="0" Grid.Row="1"><Run Text="&lt;"/></TextBlock>
                            <Rectangle Grid.Column="0" Grid.Row="2" Style="{StaticResource DataCell}"/>
                            <TextBlock x:Name="lblLessThanEqual" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="0" Grid.Row="2"><Run Text="&lt;="/></TextBlock>
                            <Rectangle Grid.Column="0" Grid.Row="3" Style="{StaticResource DataCell}"/>
                            <TextBlock x:Name="lblEqual" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="0" Grid.Row="3"><Run Text="="/></TextBlock>
                            <Rectangle Grid.Column="0" Grid.Row="4" Style="{StaticResource DataCell}"/>
                            <TextBlock x:Name="lblGreaterThanEqual" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="0" Grid.Row="4"><Run Text="&gt;="/></TextBlock>
                            <Rectangle Grid.Column="0" Grid.Row="5" Style="{StaticResource DataCell}"/>
                            <TextBlock x:Name="lblGreaterThan" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="0" Grid.Row="5"><Run Text="&gt;"/></TextBlock>

                            <Rectangle Grid.Column="1" Grid.Row="1" Style="{StaticResource DataCell}"/>
                            <TextBlock x:Name="txtLessThan" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1" Grid.Row="1"><Run Text="164"/></TextBlock>
                            <Rectangle Grid.Column="1" Grid.Row="2" Style="{StaticResource DataCell}"/>
                            <TextBlock x:Name="txtLessThanEqual" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1" Grid.Row="2"><Run Text="270"/></TextBlock>
                            <Rectangle Grid.Column="1" Grid.Row="3" Style="{StaticResource DataCell}"/>
                            <TextBlock x:Name="txtEqual" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1" Grid.Row="3"><Run Text="384"/></TextBlock>
                            <Rectangle Grid.Column="1" Grid.Row="4" Style="{StaticResource DataCell}"/>
                            <TextBlock x:Name="txtGreaterThanEqual" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1" Grid.Row="4"><Run Text="471"/></TextBlock>
                            <Rectangle Grid.Column="1" Grid.Row="5" Style="{StaticResource DataCell}"/>
                            <TextBlock x:Name="txtGreaterThan" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1" Grid.Row="5"><Run Text="663"/></TextBlock>
                        </Grid>
                    </Grid>
                </StackPanel>
            </Grid>
        </Grid>



    </Grid>
</UserControl>